package com.bdqn.spark.chapter05.action

import org.apache.spark.{SparkConf, SparkContext}

object Spark06_RDD_Operator_Action {
  def main(args: Array[String]): Unit = {
    val sparkConf = new SparkConf().setMaster("local[*]").setAppName("action-reduce")
    val sc = new SparkContext(sparkConf)

    // takeOrdered : 数据排序后，取N个数据
    val rdd1 = sc.makeRDD(List(4,2,3,1))
    val ints2: Array[Int] = rdd1.takeOrdered(3)(Ordering.Int.reverse)
    println(ints2.mkString(","))

    sc.stop()
  }
}
